#ifndef MATH_TYPES_H
#define MATH_TYPES_H

#include "cml/cml.h"

#include "base/types.h"


namespace math {
    
enum Axis {X = 0, Y, Z};

static const float kTolerance = 0.0000001f;

typedef cml::quaternionf_p  Quaternion;
typedef cml::matrix44f_c    Matrix;

typedef cml::vector2f       Vector2;
typedef cml::vector3f       Vector3;
typedef cml::vector4f       Vector4;

struct DegreeOfFreedom {
public:
    DegreeOfFreedom(const float & min, const float max) : min_(min), max_(max) {}
    DegreeOfFreedom(const float & min, const float & max, const float & value)
        : value_(value), min_(min), max_(max) {
        if(min_ > max_) 
            std::swap(min_, max_);

        ClampValue();
    }
     
    void SetMinMax(const float & min, const float & max) {
        min_ = min;
        max_ = max;
        
        if(min_ > max_) 
            std::swap(min_, max_);

        ClampValue();
    }
    void SetValue(const float & value){
        value_ = value;
        ClampValue();
    }

     
    const float & GetMin(){return min_;}
    const float & GetMax(){return max_;}
private:
    void ClampValue(){
        if(value_ > max_)
            value_ = max_;
        else if(value_ < min_)
            value_ = min_;
    }
     
    float value_;
    float max_;
    float min_;    
};



}
#endif //MATH_TYPES_H